﻿using System;
using System.Text;
using System.Security.Cryptography;

namespace Diary.CommonLib
{
    public class MD5
    {
        /// <summary>
        /// 16位
        /// </summary>
        /// <param name="ConvertString"></param>
        /// <returns></returns>
        public static string Encry16(string ConvertString, bool isLower=true)
        {
            MD5CryptoServiceProvider provider = new MD5CryptoServiceProvider();
            string md5 = BitConverter.ToString(provider.ComputeHash(UTF8Encoding.Default.GetBytes(ConvertString)), 4, 8);
            md5 = md5.Replace("-", "");
            if (isLower)
            {
                md5 = md5.ToLower();
            }
            return md5;
        }


    }
}
